#ifndef __PLATFORM_DEVICE_H__
#define __PLATFORM_DEVICE_H__

#include "linux/of.h"
#include "linux/types.h"
#include "linux/device.h"
#include "linux/ioport.h"

struct platform_device_id
{
    char name[20];
    unsigned long driver_data;
};

struct platform_device
{
    char *name;
    int id;
    int id_auto;
    int num_resources;
    struct resource *resource;
    struct platform_device_id *id_entry;
    
    struct device dev;
    void *device_data;

};

struct platform_driver
{
    char *name;
    int (*probe)(struct platform_device *pdev);
    int (*remove)(struct platform_device *pdev);
    
    struct device_driver driver;
    struct platform_device_id *id_table;
};

struct platform_device *platform_device_alloc( char *name, int id);
void platform_device_put(struct platform_device *pdev);
extern int platform_bus_init(void);
extern struct resource *platform_get_resource(struct platform_device *pdev, unsigned int type, unsigned int num);
extern int platform_driver_register(struct platform_driver *pdrv);
extern void platform_driver_unregister(struct platform_driver *pdrv);
extern int platform_device_register(struct platform_device *pdev);
extern int platform_device_unregister(struct platform_device *pdev);
extern struct platform_device *platform_alloc_device(char *name, int id);
extern int platform_get_irq(struct platform_device *dev, unsigned int num);

extern struct bus_type platform_bus_type;
extern struct device platform_bus;


#endif

